package com.wang.friend.controller;

import com.wang.common.file.domain.OSSResult;
import com.wang.friend.service.IFileService;
import com.wang.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "OSS头像文件上传功能接口")
@RestController
@RequestMapping("/file")
public class FileController {

    @Autowired
    private IFileService fileService;

    @Operation(summary = "使用阿里云oss上传头像文件")
    @PostMapping("/upload")
    public R<OSSResult> upload(@RequestBody MultipartFile file){
        return R.success(fileService.upload(file));
    }
}
